import { App } from 'vue'
import { currentRouter } from './current'
import { back, to } from './guard'


export * from './guard'
export * from './listener'

export const isHashRouter = (): boolean => {
  const history = currentRouter.value?.options.history
  return Boolean(history && (history.base.endsWith('/#') || history.base.endsWith('#')))
}

export const installRouter = (app: App): void => {
  const props = app.config.globalProperties
  props.$to = to
  props.$back = back
}
